<?php
defined('IN_PHPCMS') or exit('No permission resources.');
pc_base::load_sys_class('model', '', 0);

class classmany_model extends model {

    public function __construct() {
        $this->db_config = pc_base::load_config('database');
        $this->db_setting = 'default';
        $this->table_name = 'classmany';
        parent::__construct();
    }

    public function get($c, $id, $n = 3) {
        $sql = "select * from v9_classmany where status=99 and catid=1 and $c=$id order by id desc limit $n";
        $this->db->query($sql);
        $arr = $this->fetch_array();

        $str = '';
        foreach ($arr as $r) {
            //<a href="#"><img src="{IMG_PATH2}img/gz0.jpg"></a>
            $str .= "<a href='{$r['url']}'><img src='{$r['thumb']}'></a>";
        }

        return $str;
    }

}